Assignemnt #117 and 118th program
Code
///Name: Derrick Andreasen
///Period: 7
///Program name: 118th Program
///File name: Hund17prog.java
///Date Finished:4/26/2016
import java.util.Scanner;
public class Hund17prog
{
public static void main( String[] args ) throws Exception
{
Scanner k = new Scanner(System.in);
int choice;
System.out.println( "" );
do
{
System.out.println();
System.out.println( "1) Find two digit numbers <= 56 with sums of digits > 10" );
System.out.println( "2) Find two digit number minus number reversed which equals sum of digits" );
System.out.println( "3) Quit\n" );
choice = k.nextInt();
System.out.println();
if(choice == 1)
fiftyTen();
else if (choice == 2)
reverseSum();
}while(choice != 3);
}
public static void fiftyTen()
{
for(int a = 1; a < 6; a++)
for(int b = 0; b < 10; b++)
{
int c= a+b;
if(c > 10)
{
int d = a * 10 + b;
if(a < 5 || b < 7)
System.out.println( d );
}
}
}
public static void reverseSum()
{
for(int a = 1; a < 10; a++)
for(int b = 0; b < 10; b ++)
{
int c = a * 10 + b;
int d = b* 10 + a;
int e = a + b;
if(c - d == e)
System.out.println( c );
}
}
}
Picture of the output